<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Frontend;

/**
 * Description of CaptchaController
 *
 * @author huynq9
 */
use BaseController;
use Input;
use Gregwar\Captcha\CaptchaBuilder;
use Session;

class CaptchaController extends BaseController {

    //put your code here

    public function __construct() {
        $this->beforeFilter('csrf', array('except' => array('postIndex')));
    }

    public function postIndex() {
        if (Input::get('refreshcapcha') != '') {
            $builder = new CaptchaBuilder;
            $builder->build(106, 31);
            Session::put('phrase', $builder->getPhrase());
            return $builder->inline();
        }
    }

}
